home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* MenuUpdate */
- /* */
- /* Controls activation of menu items. */
- /************************************************************************************/
-
- #include "MyHeaders.h"
-
- short MenuUpdate(short WType)
- {
-
- MenuInfo **menuH;
- short MURetCode = 0; /* set return code */
-
- /****************************************************************************/
- /* The following are the same all the time. Not changed by this proc. */
- /* Set in the resource definition, instead. */
- /* */
- /* AppleMenuID AboutItem */
- /* HelpItem */
- /* */
- /* FileMenuID NewItem */
- /* QuitItem */
- /* */
- /* ProgramMenuID KudosItem */
- /* */
- /****************************************************************************/
-
-
- switch (WType)
- {
- case (ProcMain):
- menuH = myMenuHandle[1]; /* File menu */
- DisableItem (menuH, CloseItem);
- DisableItem (menuH, PrintItem);
- DisableItem (menuH, SaveItem);
- DisableItem (menuH, SaveAsItem);
-
- menuH = myMenuHandle[2]; /* Edit menu */
- DisableItem (menuH, CopyItem);
- DisableItem (menuH, CutItem);
- DisableItem (menuH, PasteItem);
- DisableItem (menuH, ClearItem);
- break;
-
- case (ProcText):
- workTEHandle = windTbl[windSub].windTEH[0]; /* get TE handle */
-
- menuH = myMenuHandle[1]; /* File menu */
- EnableItem (menuH, CloseItem);
-
- if (windTbl[windSub].windTEChanged == TRUE)
- EnableItem (menuH, SaveItem);
- else
- DisableItem (menuH, SaveItem);
-
- EnableItem (menuH, SaveAsItem);
-
- if ((**workTEHandle).teLength > 0)
- EnableItem (menuH, PrintItem);
- else
- DisableItem (menuH, PrintItem);
-
- menuH = myMenuHandle[2]; /* Edit menu */
- if (((**workTEHandle).selStart < (**workTEHandle).selEnd)
- && (**workTEHandle).teLength > 0)
- {
- EnableItem (menuH, CopyItem);
- EnableItem (menuH, CutItem);
- EnableItem (menuH, ClearItem);
- }
- else
- {
- DisableItem (menuH, CopyItem);
- DisableItem (menuH, CutItem);
- DisableItem (menuH, ClearItem);
- }
-
- worklong = GetScrap (NIL,'TEXT',&scrapOffset); /* desk scrap info */
- if (worklong > 0) /* if something there */
- EnableItem (menuH, PasteItem); /* enable "Paste" */
- else
- DisableItem (menuH, PasteItem); /* else disable "Paste" */
-
- break;
-
- case (ProcHelp):
- menuH = myMenuHandle[1]; /* File menu */
- EnableItem (menuH, CloseItem);
- DisableItem (menuH, PrintItem);
- DisableItem (menuH, SaveItem);
- DisableItem (menuH, SaveAsItem);
-
- menuH = myMenuHandle[2]; /* Edit menu */
- DisableItem (menuH, CopyItem);
- DisableItem (menuH, CutItem);
- DisableItem (menuH, PasteItem);
- DisableItem (menuH, ClearItem);
- break;
- }
-
- return MURetCode; /* return*/
- }